<template>
	<view >
		<view class="" style="height: 100rpx;mar" >
			<u-navbar  leftText="返回" title="我的证书"  @leftClick="back" @rightClick="gohistory">
				<view class="u-nav-slot" slot="left">
					<u-icon name="arrow-left" size="19"></u-icon>
				</view>
				<view class="u-nav-slot" slot="right">
					<text style="color: #1989FA;">新增</text>
				</view>
			</u-navbar>
		</view>
		
		<view class="content">
			<view @click="study(item.id)" class="content-topic" v-for="item in list" :key="item.id">
				<view class="img">
					<image :src="item.xgfj" mode=""></image>
				</view>
				<view class="title">
					<text>{{item.zsmc}}</text>
				</view>
				<text class="p">{{item.yxrq}}</text>
			</view>
		</view>
	</view>
</template>

<script>
	import {
		pageList
	} from '@/api/certificate'
	export default {
		data() {
			return {
				list: [],
				queryParams: {
					pageNum: 1,
					pageSize: 10,
				},
			}

		},
		onShow() {
			this.queryParams.userid=uni.getStorageSync('userId')
			this.getlist()
		},
		onReachBottom() {
			console.log(this.list.length,this.queryParams.pageSize,123);
			if(this.list.length<this.queryParams.pageSize){
				return
			}else{
				this.queryParams.pageSize+=10
				this.getlist()
			}
			
		},
		methods: {
			getlist(){
				pageList(this.queryParams)
				.then(res=>{
					this.list=res.data.list
				})
			},
			back() {
				uni.navigateBack()
			},
			gohistory() {
				uni.navigateTo({
					url: '/pages/addcertificate/addcertificate'
				})

			},
			study(id) {
				uni.navigateTo({
					url: `/pages/lookcertificate/lookcertificate?id=${id}`
				})
			}
		}
	}
</script>

<style lang="scss">
	page{
		background-color: #f5f5f5;
	}
	.content {
		width: 100%;
		padding: 40rpx 24rpx 60rpx;
		box-sizing: border-box;
		display: flex;
		justify-content: space-between;
		background-color: #f6f6f6;
		flex-wrap: wrap;

		.content-topic {
			width: 339rpx;
			height: 408rpx;
			background-color: #fff;
			text-align: center;
			border-radius: 12rpx;
			margin-bottom: 40rpx;

			.img {
				width: 339rpx;
				height: 308rpx;
				border-top-left-radius: 12rpx;
				border-top-right-radius: 12rpx;
				display: flex;
				justify-content: center;
				align-items: center;

				image {
					width: 200rpx;
					height: 260rpx;
				}
			}

			.title {
				color: #333333;
				font-size: 28rpx;
			}

			.p {
				color: #999999;
				font-size: 22rpx;
			}

		}
	}
</style>
